from django.db import models
from django.contrib.auth.models import AbstractUser


class User(AbstractUser):
    """自定义用户模型类"""
    GENDER_CHOICES = (
        (0, 'male'),
        (1, 'female'),
        (2, 'baomi')
    )

    mobile = models.CharField(max_length=11, unique=True, verbose_name='手机号')
    zheng_username = models.CharField(max_length=150, default='', verbose_name='真实姓名')
    gender = models.SmallIntegerField(choices=GENDER_CHOICES, default=2, verbose_name='性别')
    qq_user = models.CharField(max_length=11, default='', verbose_name='用户qq号')
    tel = models.CharField(max_length=20, null=True, blank=True, default='', verbose_name='固定电话')
    image = models.CharField(max_length=150, default='', verbose_name='头像图片')

    class Meta:
        db_table = 'tb_users'
        verbose_name = '用户'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.username
